<?php
require_once(ROOTDIR."/include/database/class.BanQueries.php");

$ip = $_GET['ip'];
$active = $_GET['active'];

// Switch the current active state to the other state
// off becomes on, and on becomes off
if($active == 0) {
  $active = 1;
} else {
  $active = 0;
}

$banQueries = new BanQueries();

$banQueries->updateBanIpActiveStatus($active, $ip);

// Send back the new active state
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
?>
<?echo "<?xml version=\"1.0\" ?>";?>
<root>
  <ip><?=$ip?></ip>
	<update><?=$active?></update>
</root>
